Skip to main content

Test your integration with test Ads

To help you test your integration during development, you can enable test ads via the SDK. This is useful to quickly test how your app flow works when showing ads and listening to the different callbacks.

Once you finish testing your integration remember to run your app on a physical device.

Request Test Ads

When testing you should request ads by setting the test flag to true when initializing XMediator and when creating ad instances. We use this flag to ask the underlying networks to provide us with test ads when possible.

info

Some mediation services (or their underlying networks) may not support this flag and might provide other means to test their integration, so make sure to always check their documentation for any additional steps.

We do provide test Placement Ids to enable a quick way to test the integration.

Test Placement Ids

PlacementMAX MediationLevelPlay MediationAdMob Mediation
App keyV148L42DB1V148L42DB8V148L48DBJ
BannerV142DR9L2247MGV142DR2LD0QYR1V14JHR4Z2LKRFYNP
InterstitialV142DRJLE1G5XXV142DR1L7WJN07V14JHR28KLVMZGXJ
App OpenV14JHR4ZKL86RTC2-V14JHR283LMV0WYT
RewardedV142DR4LW2MT4BV142DR8L1DP5NDV14JHR282L889BY3

Currently, these placements are only supported for these ad networks: Google Ads, AppLovin and Unity Ads.

warning

Remember to replace these test placements with your own placements and always set the test and verbose flags to false in a production environment

Enable test mode

Set the test flag to true to see test ads when available.

auto* sdk = x3mads::XMediatorAds::getInstance();

bool shouldRequestTestAds = true; // e.g. set true for debug builds

x3mads::InitSettings settings;
settings.test = shouldRequestTestAds;

x3mads::UserProperties user;
user.userId = x3mads::Optional<std::string>("<your-user-id>");
settings.userProperties = x3mads::Optional<x3mads::UserProperties>(user);

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
auto appKey = "V148L42DRG";
auto bannerPlacementId = "V142XB3LRNZCM7";
auto interstitialPlacementId = "V142XBGL601BCD";
auto rewardedPlacementId = "V142DRKLYD2CVX";
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
auto appKey = "V148L42DB1";
auto bannerPlacementId = "V142DR9L2247MG";
auto interstitialPlacementId = "V142DRJLE1G5XX";
auto rewardedPlacementId = "V142DR4LW2MT4B";
#endif

sdk->startWith(appKey, settings, [=](const x3mads::InitResult&) {
sdk->banner->addListener(this);
sdk->interstitial->addListener(this);
sdk->rewarded->addListener(this);

sdk->banner->create(bannerPlacementId, x3mads::BannerSize::PHONE);
sdk->interstitial->load(interstitialPlacementId);
sdk->rewarded->load(rewardedPlacementId);
});

Enable verbose logging

Setting the verbose flag to true will output extra logging information to Logcat on Android and to the standard output on iOS.

auto* sdk = x3mads::XMediatorAds::getInstance();

x3mads::InitSettings settings;
settings.verbose = true;

x3mads::UserProperties user;
user.userId = x3mads::Optional<std::string>("<your-user-id>");
settings.userProperties = x3mads::Optional<x3mads::UserProperties>(user);

sdk->startWith("<your-app-key>", settings, [](const x3mads::InitResult&){});